<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Account/classes/PhpFox_ComponentContactPanel.class.php, $Author:  $ */



/** Contact panel component (in user profile)
 *
 * Parameters:
 *  1. oUser (required) - user account object
 *
 * @package module.account
 * @version $Id: PhpFox_ComponentContactPanel.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *
 */
class PhpFox_Mod_Account_ComponentContactPanel extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
	    $oUser = $this->getParam('oUser');
	    /* @var $oUser PhpFox_Mod_Account_ItemAccount */
	    assert($oUser != null);

	    $oCurrUser = $this->getParam('oCurrUser');
	    /* @var $oCurrUser PhpFox_Mod_Account_ItemAccount */
	    //assert($oCurrUser != null);

	    $oSrvSec = $this->_oModule->getService('Security');
	    /* @var $oSrvSec PhpFox_Mod_Account_ServiceSecurity */

	    //check blocking status
        $oSrvBlock = &$this->_oModule->getService('Block');
        /* @var $oSrvBlock PhpFox_Mod_Account_ServiceBlock */

        $bLoggedIn = false;

        if(App::getUser('id'))
        {
            $bIsBlocked = $oSrvBlock->isBlocked($oCurrUser, $oUser);
            $bLoggedIn = true;
        }
        else
        {
            $bIsBlocked = false;
            $bLoggedIn = false;
        }

        $aMembData = $oSrvSec->getUserMembershipData();

		$oTpl = &$this->_oModule->getTemplate();
		$oTpl->assign(array(
		    'bLoggedIn'   => $bLoggedIn,
		    'aUser'       => $oUser->aData,
		    'aCurrUser'   => (isset($oCurrUser->aData) ? $oCurrUser->aData : ''),
    		'bIsBlocked'  => $bIsBlocked,
            'bCrush'      => $oSrvSec->checkAccess('crush', '', false),
            'bRate'       => $oSrvSec->checkAccess('rate', '', false),
            'bAllowBlock' => ($oSrvSec->isStaff() || $aMembData['allow_block']),
            'iImChatWidth' => App::getParam('im_chat_width'),
        	'iImChatHeight' => App::getParam('im_chat_height')
		));
		$srcHtml = $oTpl->fetch('ContactPanel.html');
		return $srcHtml;
	}
}
?>